package kang.zhoujin.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.InvalidPropertiesFormatException;
import java.util.Iterator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Properties;
import java.util.Queue;

import org.jdom.Content;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;


public class ConfigUtil {
	private static String accountConfigFile = "./resources/dnAccount-config.xml";
	private static String propertiesFile = "./resources/properties.xml";	
	private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	

	public static Properties getProperties() throws InvalidPropertiesFormatException, FileNotFoundException, IOException{
		Properties properties = new Properties();
		properties.loadFromXML(new FileInputStream(propertiesFile));
		return properties;
	}
	
	public static void setProperties(String key,String value) throws InvalidPropertiesFormatException, FileNotFoundException, IOException{
		Properties properties = new Properties();
		properties.loadFromXML(new FileInputStream(propertiesFile));
		FileOutputStream out = new FileOutputStream(propertiesFile);
		properties.setProperty(key, value);
		properties.storeToXML(out,"");
	}
	
	
}
